/*
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package backend.com.zyc.util.log4j;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import util.Constants;
import backend.com.zyc.util.ResouceLoader;

/**
 * 
 * @author Administrator
 * 
 */
public class Log {
	private static Logger logger;

	public static Logger getLogger() {
		return getLogger(Log.class);
	}

	public static Logger getLogger(Class<? extends Object> clazz) {
		logger = Logger.getLogger(clazz);
		PropertyConfigurator.configure(ResouceLoader
				.getFileURL(Constants.LOG4J_FILE));
		logger.setLevel(Level.INFO);
		return logger;
	}

//	public static int test() {
//		return 10 / 0;
//
//	}
//
//	public static void main(String[] args) {
//		Logger logger = Log.getLogger();
//		logger.debug("debug test.");
//		logger.info("Info test");
//		try {
//			test();
//		} catch (Exception t) {
//			logger.error(t.getMessage(), t);
//		}
//	}
}
